You are here: Symbol Reference > Dew Namespace > Dew.Stats Namespace > Dew.Stats.Units Namespace > Classes > Statistics Class > Statistics Methods > PCA Method > Statistics.PCA Method ([In] TMtx, [In] TMtx, [In] TVec, [In] TVec)
Dew Stats for .NET
ContentsIndexHome
PreviousUpNext
Statistics.PCA Method ([In] TMtx, [In] TMtx, [In] TVec, [In] TVec)

Performs a principal component analysis (PCA).

Syntax
C#
Visual Basic
public static void PCA([In] TMtx CovMat, [In] TMtx PC, [In] TVec EigenVec, [In] TVec VarPct);

Perform a PCA by using the original data covariance matrix CovMat. Return the principal components in PC matrix, eigenvalues of the covariance matrix (variances) in vector EigenVec and (optional) the percentage of total variance in vector VarPct. The PC, EigenVec and VarPct dimensions are adjusted automatically.

using Dew.Math; using Dew.Stats; using Dew.Stats.Units; namespace Dew.Examples { private void Example { Matrix data = new Matrix(0, 0); Matrix PC = new Matrix(0, 0); Vector Z = new Vector(0); Vector variances = new Vector(0); data.SetIt(2,4, false, new double[] { 1,3,5,2,2,5,7,9}); Statistics.Covariance(data,covMat,false); Statistics.PCA(covMat, PC, Z, variances); //requires cov matrix // Z = [29 , 0, 0 ,0 ] //variance = [100, 0, 0 ,0 ] } }
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!